{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Pulse gates\n",
    "\n",
    "Most quantum algorithms can be described with circuit operations alone. When we need more control over the low-level implementation of our program, we can use _pulse gates_. Pulse gates remove the constraint of executing circuits with basis gates only, and also allow you to override the default implementation of any basis gate.\n",
    "\n",
    "Pulse gates allow you to map a logical circuit gate (e.g., `X`) to a Qiskit Pulse program, called a `Schedule`. This mapping is referred to as a _calibration_. A high fidelity calibration is one which faithfully implements the logical operation it is mapped from (e.g., whether the `X` gate calibration drives $|0\\rangle$ to $|1\\rangle$, etc.).\n",
    "\n",
    "A schedule specifies the exact time dynamics of the input signals across all input _channels_ to the device. There are usually multiple channels per qubit, such as drive and measure. This interface is more powerful, and requires a deeper understanding of the underlying device physics.\n",
    "\n",
    "It's important to note that Pulse programs operate on physical qubits. A drive pulse on qubit $a$ will not enact the same logical operation on the state of qubit $b$ -- in other words, gate calibrations are not interchangeable across qubits. This is in contrast to the circuit level, where an `X` gate is defined independent of its qubit operand.\n",
    "\n",
    "This page shows you how to add a calibration to your circuit.\n",
    "\n",
    "**Note:** To execute a program with pulse gates, the backend has to be enabled with OpenPulse. You can check via ``backend.configuration().open_pulse``, which is ``True`` when OpenPulse is enabled. If it is enabled and the pulse gates feature is not enabled, you can [schedule](07_pulse_scheduler.ipynb) your input circuit."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Build your circuit\n",
    "\n",
    "Let's start with a very simple example, a Bell state circuit."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQUAAACoCAYAAADpY/sVAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAATqklEQVR4nO3dfVRVdb7H8fc5PKYCWkwqghoI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qKur49FHH+WJJ56gurq61brvvfcea9asIT4+nueee44JEyawbt06bDYbubm5zJkzh0uXnPwDbIfbhsKmTZvYsGEDeXl5JCYmApCcnMzHH39Mbm4ucXFxFlfoWcr+7pp2P/9KodCe559/npSUFE6ePMntt99OQUFBp9sUFRWRlZXFrl278Pf3p76+nieeeKLHAgHcePqwevVqZsyY0RIIzUaMGIGPjw9jx44F4Le//S1RUVHY7Xa2bNliRake4fi3Lmr3lGva9XQ///nPmTdvHufOnWPatGldCgRo2qm4fft2/P39OXLkCF5eXuTk5ODn13NnjrnlSKGiooLS0lKWLVvW6rny8nJiYmJa/pNmzJjBvHnzWLBgQbf6sNl61xk4i/67Ct8bLr+ld3aEob3nm29A2+ylV94gdeIvrrG6q7fiseeBpp/n9x9byW6389RTTwHw4IMPUlJS0qXtvr9TMTc3l3nz5rFv3z5iYmJYtGhRq49JOxyObr3Wrt5L2i1HChUVFQAMGjTIWH7+/HkcDocxdZg0aRLh4eE9Wp9HctEfis3mlr9Clrr99tsZPnw4hw8f5plnnunSNlcGwpw5c6iurubBBx8EYNGiRT0Wdm45UggODgagrKyMlJSUluVr1qyhsrKS+Pj4a+6jq6l5vVj1Opyqufz9le/4zZpHCO09f6XUO2fy+lrr/i+bbz/f2NhoPO5JSUlJxvUU5s6dCzTtU+hKLW0FQvM+hL/85S8cP36cqKgo4uLiKCoqatkuMTGRvLw8574Y3DQUwsPDGTt2LKtXr+bGG29kyJAhbNmyhW3btgE4JRR6myEDzFBwlrAbnd+mp0tISABgx44dna7bUSAA1NfXk5eXR1paGgkJCUYouIpbjv3sdjubN29umUvNnz+f4OBgsrKy8PLyatnJKF0XcbNr2g13UbueytfXl8jISOrq6vj0045P5OgsEJo1X+otJibGFSW34pYjBYCoqCh27txpLEtLS2PUqFHccMMNFlXluRJugTeLm051dpZhNzWNQMT08MMPY7PZqKtr/wMi3t7ebNmypdNAANi9ezerVq1i7969rirZrK1HenGSwsJCJk6caCxbuXIlL774IidPnuTAgQMsXboUh8N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hYKIGBQKImJQKIiIQaEgIob/B8D2YAvqm+wfAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 327.252x204.68 with 1 Axes>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from qiskit import QuantumCircuit\n",
    "\n",
    "circ = QuantumCircuit(2, 2)\n",
    "circ.h(0)\n",
    "circ.cx(0, 1)\n",
    "circ.measure(0, 0)\n",
    "circ.measure(1, 1)\n",
    "\n",
    "circ.draw('mpl')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Build your calibrations\n",
    "\n",
    "Now that we have our circuit, let's define a calibration for the Hadamard gate on qubit 0.\n",
    "\n",
    "In practice, the pulse shape and its parameters would be optimized through a series of Rabi experiments (see the [Qiskit Textbook](https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-openpulse.html) for a walk through). For this demonstration, our Hadamard will be a Gaussian pulse. We will _play_ our pulse on the _drive_ channel of qubit 0.\n",
    "\n",
    "Don't worry too much about the details of building the calibration itself; you can learn all about this on the following page: [building pulse schedules](06_building_pulse_schedules.ipynb)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from qiskit import pulse\n",
    "from qiskit.pulse.library import Gaussian\n",
    "from qiskit.test.mock import FakeValencia\n",
    "\n",
    "backend = FakeValencia()\n",
    "\n",
    "with pulse.build(backend, name='hadamard') as h_q0:\n",
    "    pulse.play(Gaussian(duration=128, amp=0.1, sigma=16), pulse.drive_channel(0))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's draw the new schedule to see what we've built."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAyAAAACgCAYAAAD0KAgtAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zL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b0U+BnkjoADwEdgQOBCyLiv1m+BZL+QAqibo+I2bkylko6C/hDlud20oDqL2V5X6xj17eQWoVGSrqCNFZlXdLsVO9ExC/rqfLE7Ocpku4A5kXE+HryrqwhrNx38CzQHvgfUusOEbEkaz27QulN8E+TZuT6bGHb/5AFgpLeBxYXztsOpBm9zMxaBI8BMTMr34Wkp81XkYKQn5JmwtopIv6dzxgR7wB/Jc1OVHw6PYY0tewfSQOQtwe+krupfBq4HPheVsYNWZmvksZGzCNN2zoCuIDULWkSq0FEXEzqCrVXVtcbSF1+5hSy/iX7eVMhnYj4I+nGekvSAP1bst/rfDlg1uqzJ2k2qAtI5/rXpLE2LzRQ1ymkgPBw0g1/uS0uZVvZ7yDb7v8B+xdW/Qr4OSngups0vfFZhW0XAN8kXSejgL+V1knaljSdcVMHrpuZ1Yyq04pvZta6SFqH1PXo9Ij4fa3rs7plT/KPAj6VzbBlBZK+D5wcEVtXsMyLgR0jwu8BMbMWwy0gZmYVJKlb9nK/a0itBLfXuEqrlaTPSDqM1EpyjYOPBt0IrCepIsGCpLVILSMXVaI8M7Nq8RgQM7PK2h54ivT28eMjYl6N67O63QB8Ebif1DXN6hERcyWdAKxVoSI3AS6s9NgfM7PVzV2wzMzMzMysatwFy8zMzMzMqsYBiJmZmZmZVY0DEDMzMzMzqxoHIGZmZmZmVjUOQMzMzMzMrGocgJiZmZmZWdX8f34pa22P1a8jAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 936x118.8 with 1 Axes>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "h_q0.draw()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Link your calibration to your circuit\n",
    "\n",
    "All that remains is to complete the registration. The circuit method `add_calibration` needs information about the gate and a reference to the schedule to complete the mapping:\n",
    "\n",
    "    QuantumCircuit.add_calibration(gate, qubits, schedule, parameters)\n",
    "\n",
    "The `gate` can either be a `circuit.Gate` object or the name of the gate. Usually, you'll need a different schedule for each unique set of `qubits` and `parameters`. Since the Hadamard gate doesn't have any parameters, we don't have to supply any."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "circ.add_calibration('h', [0], h_q0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lastly, note that the transpiler will respect your calibrations. Use it as you normally would (our example is too simple for the transpiler to optimize, so the output is the same)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['id', 'u1', 'u2', 'u3', 'cx']\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAASIAAACoCAYAAABE4uO8AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAWuklEQVR4nO3de1jUdb4H8PeMCMhF5ZKB3FZugqPIxS3Ay8CSircs85rHhwyPmHpIK1fLXNu1w5PGPg92am17ykunNBdqlVwQzWB2UdRAMRENFZBLrCVgiNxk+J0/OJAjCDMwM1+Q9+t55nH4Xb7fzwC++X5/v9/8RiZJkgQiIoHkogsgImIQEZFwDCIiEo5BRETCMYiISDgGEREJxyAiIuEYREQkHIOIiIRjEBGRcAwiIhKOQUREwjGIiEg4BhERCccgIiLhGEREJByDiIiEYxARkXAMIiISjkFERMIxiIhIOAYREQnHICIi4RhERCQcg4iIhGMQEZFwJqILoI6+ygbKq43fr5MNMG+C8fsVad26dcjNzTV6v/7+/khISDB6v30Vg6gPKq8Grv8kuoqBITc3FyqVSnQZAx6nZkQkHIOIiIRjEBGRcAwiIhKOQUREwjGIiEg4nr4n0tHIkSPh5eUFU1NT3LlzB5cuXcKdO3ceuv2qVauQmJiIyspKI1bZv3BEpKVffvkFq1atwog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8fHEBEaBLlMhkWzwmE6uO9fBSOXyTB/ZhjMzUzhP8YTfl0cVBeBUzMd5eTkYMqUKXBxccHGjRvh5uaGoqIinDp1Cp988kmX+7Z91C/RQKDLR1r3/SjvY1599VVYWlrizJkzGDbs11FKdHS0wKqI+jeOiHRQV1cHa2trrF27Fjt37jRoX0dOZOFUTh5e+c+FnJbRI48jIh1UV1ejpaWlxxeh9WRqFv/RwR71RSSaLlMzHqzWgY2NDeRyOcrLy0WXQvRI4dRMR+Hh4cjPz8fVq1cxdOhQvbd/p7YO2/96AH4+Hlg4K0zv7RP1RRwR6Sg+Ph61tbUIDg7G3r17kZ6ejn379mHFihV6aV915gJa1C34XWjX7xEiepTwGJGOgoKCkJWVhS1btmD9+vVoaGiAi4sLFi9e3Ou2JUlCXUMDAnjdEA0wnJr1QS0tLZDLOVilgYNBRETC8c8uEQnHICIi4RhERCQcg4iIhGMQEZFwDCIiEo5BRETCMYiISDgGEREJxyAiIuEYREQkHIOIiIRjEBGRcAwiIhKOQUREwjGIiEg4BhERCccgIiLhGEREJByDiIiEYxARkXAMIiISjkFERMIxiIhIOAYREQnHICIi4RhERCTc/wH0o/hQQ2msPAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 365.038x204.68 with 1 Axes>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from qiskit import transpile\n",
    "from qiskit.test.mock import FakeAlmaden\n",
    "\n",
    "backend = FakeAlmaden()\n",
    "\n",
    "circ = transpile(circ, backend)\n",
    "\n",
    "print(backend.configuration().basis_gates)\n",
    "circ.draw('mpl', idle_wires=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Notice that `h` is not a basis gate for the mock backend `FakeAlmaden`. Since we have added a calibration for it, the transpiler will treat our gate as a basis gate; _but only on the qubits for which it was defined_. A Hadamard applied to a different qubit would be unrolled to the basis gates.\n",
    "\n",
    "That's it!\n",
    "\n",
    "## Custom gates\n",
    "\n",
    "We'll briefly show the same process for nonstandard, completely custom gates. This demonstration includes a gate with parameters."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAB7CAYAAACywvZ+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAARRklEQVR4nO3deVxU9f7H8dfMIC5soiwqDOOGRi6hTmCWAS65kJagNyz5XQtKb2VpLlmG2iJmYS63yBJTMy1TsnvLNVFIL4pgYrikkBrihoAii2jA/P4wJ4nVHJnR83k+HjweM+d8z/d85jDvOcucM0dlMBgMCCHuempzFyCEqB8SdiEUQsIuhEJI2IVQCAm7EAohYRdCISTsQiiEhF0IhZCwC6EQEnYhFELCLoRCSNiFUAgJuxAKIWEXQiEk7EIohIRdCIWQsAuhEBJ2IRRCwi6EQkjYhVAICbsQCiFhF0IhJOxCKISEXQiFkLALoRASdiEUwsrcBZjbkW1QkG3uKoQp2blAxz633s/48eNJTU299Y5ukre3N/Pnzzd5v4oPe0E2XMwydxXCEqWmppKQkGDuMkxGNuOFUAgJuxAKIWEXQiEk7EIohIRdCIWQsN+F3vtqNHPXhJu7jFvSf7KKA8d3mruMu4qEXQgzcnBwqLd5Kf579qqMimzNIJ9w9mXEceRkMi2ateG1kSs5ce4gyzdHcLHoPA93HcH4oEXM/vIpHO1a8MJjC4zTb9rzGV9ui2TZq+moVKpq53P5SiGfb5nJzgPfkF90HmcHLeODP6FL295M/Nif7p79eKrfG8b2/SermPf8Djq3eYiMU/v48NtxHD+bhkalQetyD+88s54NSYvZtm8lAPGpXwHw7dv5aNQavkv8mG92ziev4CweLl48F/g+Xdr2BuDzLTNJO76DDu56Nid/RrmhnCf7TKN312CiVj/Nkaxk3J068OrIL9C5etW6DJMOr+fT7y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Z6srCwOHToEwJIlSwgKCjJpnRJ2IW5R40YNGRHoX+14W5vGDBvQu9IttG+k0WiIiYlh+PDhtGvXDltbW0JDQ01ap/yUtBAm8n3cLnampFUaPnr4QO5p52GGiiqSNbsQJjLA735cmjtWGObr7WURQQcJuxAm08DKiieGBKBRX4tVc0d7Bgf0NHNVf7LYsKelpREcHIyTkxONGjXC09OTadOmmbssIWrk5upEv4d6oFKpeCIwgIbWlnPfe4v8nn3v3r08/PDDaLVa3n//fXQ6HcePHycxMbHWaa/fckcIc4v+4j/1Mp+63l7KIsM+ceJEbGxsSEpKwsHBwTg8LCzMjFUJcWezuKPxxcXF2NnZ8eKLL7JgwQJzlyPEXcPi1uwXLlygvLz8b589JJvxQmnquhlvcQfoHB0dUavVnDp1ytylCHFXsbjNeICAgAAOHTpEeno69vb25i5HiLuCRYb9+tF4nU7HlClT0Ol0ZGZmsmPHDmJiYsxdnhB3JIvbZwfo0aMHu3btIiIiggkTJlBSUoJWqyUkJMTcpQlxx7LINbsQwvQs7gCdEOL2kLALoRASdiEUQsIuhEJI2IVQCAm7EAohYRdCISTsQiiEhF0IhZCwC6EQEnYhFELCLoRCSNiFUAgJuxAKIWEXQiEk7EIohIRdCIWQsAuhEBJ2IRRCwi6EQkjYhVAICbsQCiFhF0IhJOxCKISEXQiFkLALoRASdiEUQsIuhEL8P6UHBHi/Jg2kAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 314.126x144.48 with 1 Axes>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from qiskit import QuantumCircuit\n",
    "from qiskit.circuit import Gate\n",
    "\n",
    "circ = QuantumCircuit(1, 1)\n",
    "custom_gate = Gate('my_custom_gate', 1, [3.14, 1])\n",
    "# 3.14 is an arbitrary parameter for demonstration\n",
    "circ.append(custom_gate, [0])\n",
    "circ.measure(0, 0)\n",
    "\n",
    "circ.draw('mpl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "with pulse.build(backend, name='custom') as my_schedule:\n",
    "    pulse.play(Gaussian(duration=64, amp=0.2, sigma=8), pulse.drive_channel(0))\n",
    "\n",
    "circ.add_calibration('my_custom_gate', [0], my_schedule, [3.14, 1])\n",
    "# Alternatively: circ.add_calibration(custom_gate, [0], my_schedule)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If we use the `Gate` instance variable `custom_gate` to add the calibration, the parameters are derived from that instance. Remember that the order of parameters is meaningful."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPsAAAB7CAYAAACywvZ+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAARRklEQVR4nO3deVxU9f7H8dfMIC5soiwqDOOGRi6hTmCWAS65kJagNyz5XQtKb2VpLlmG2iJmYS63yBJTMy1TsnvLNVFIL4pgYrikkBrihoAii2jA/P4wJ4nVHJnR83k+HjweM+d8z/d85jDvOcucM0dlMBgMCCHuempzFyCEqB8SdiEUQsIuhEJI2IVQCAm7EAohYRdCISTsQiiEhF0IhZCwC6EQEnYhFELCLoRCSNiFUAgJuxAKIWEXQiEk7EIohIRdCIWQsAuhEBJ2IRRCwi6EQkjYhVAICbsQCiFhF0IhJOxCKISEXQiFkLALoRASdiEUwsrcBZjbkW1QkG3uKoQp2blAxz633s/48eNJTU299Y5ukre3N/Pnzzd5v4oPe0E2XMwydxXCEqWmppKQkGDuMkxGNuOFUAgJuxAKIWEXQiEk7EIohIRdCIWQsN+F3vtqNHPXhJu7jFvSf7KKA8d3mruMu4qEXQgzcnBwqLd5Kf579qqMimzNIJ9w9mXEceRkMi2ateG1kSs5ce4gyzdHcLHoPA93HcH4oEXM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PJw1a9aQkZHBpUuX+OKLqu8A/HdJ2IWwAMnJybRq1cp4p9iwsDBiY2NNOg8JuxAWICsrC632z1t4eXh4cPLkSZPOQ/G/QSfErcg8nc26zTsqDV+wNLbS40YNrfln8AAaNbSu1L4+fh1O1uxC3AKPVi60cHbkTHYuZ7L/vG/7Xx+fyc5F37VjlUEH0Gq1FdbkmZmZuLu7m7RWCbsQt2hovwdxsLOpsU3nDm3o3smz2vF6vZ6srCwOHToEwJIlSwgKCjJpnRJ2IW5R40YNGRHoX+14W5vGDBvQu9IttG+k0WiIiYlh+PDhtGvXDltbW0JDQ01ap/yUtBAm8n3cLnampFUaPnr4QO5p52GGiiqSNbsQJjLA735cmjtWGObr7WURQQcJuxAm08DKiieGBKBRX4tVc0d7Bgf0NHNVf7LYsKelpREcHIyTkxONGjXC09OTadOmmbssIWrk5upEv4d6oFKpeCIwgIbWlnPfe4v8nn3v3r08/PDDaLVa3n//fXQ6HcePHycxMbHWaa/fckcIc4v+4j/1Mp+63l7KIsM+ceJEbGxsSEpKwsHBwTg8LCzMjFUJcWezuKPxxcXF2NnZ8eKLL7JgwQJzlyPEXcPi1uwXLlygvLz8b589JJvxQmnquhlvcQfoHB0dUavVnDp1ytylCHFXsbjNeICAgAAOHTpEeno69vb25i5HiLuCRYb9+tF4nU7HlClT0Ol0ZGZmsmPHDmJiYsxdnhB3JIvbZwfo0aMHu3btIiIiggkTJlBSUoJWqyUkJMTcpQlxx7LINbsQwvQs7gCdEOL2kLALoRASdiEUQsIuhEJI2IVQCAm7EAohYRdCISTsQiiEhF0IhZCwC6EQEnYhFELCLoRCSNiFUAgJuxAKIWEXQiEk7EIohIRdCIWQsAuhEBJ2IRRCwi6EQkjYhVAICbsQCiFhF0IhJOxCKISEXQiFkLALoRASdiEUQsIuhEL8P6UHBHi/Jg2kAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 314.126x144.48 with 1 Axes>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "circ = transpile(circ, backend)\n",
    "circ.draw('mpl', idle_wires=False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Normally, if we tried to transpile our `circ`, we would get an error. There was no functional definition provided for `\"my_custom_gate\"`, so the transpiler can't unroll it to the basis gate set of the target device. We can show this by trying to add `\"my_custom_gate\"` to another qubit which hasn't been calibrated."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\"Cannot unroll the circuit to the given basis, ['id', 'u1', 'u2', 'u3', 'cx']. Instruction my_custom_gate not found in equivalence library and no rule found to expand.\"\n"
     ]
    }
   ],
   "source": [
    "circ = QuantumCircuit(2, 2)\n",
    "circ.append(custom_gate, [1])\n",
    "\n",
    "\n",
    "from qiskit import QiskitError\n",
    "try:\n",
    "    circ = transpile(circ, backend)\n",
    "except QiskitError as e:\n",
    "    print(e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/thomas/opt/anaconda3/envs/qiskit-3.8/lib/python3.8/site-packages/qiskit/aqua/operators/operator_globals.py:48: DeprecationWarning: `from_label` is deprecated and will be removed no earlier than 3 months after the release date. Use Pauli(label) instead.\n",
      "  X = make_immutable(PrimitiveOp(Pauli.from_label('X')))\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<h3>Version Information</h3><table><tr><th>Qiskit Software</th><th>Version</th></tr><tr><td>Qiskit</td><td>0.23.6</td></tr><tr><td>Terra</td><td>0.17.0</td></tr><tr><td>Aer</td><td>0.7.5</td></tr><tr><td>Ignis</td><td>0.5.2</td></tr><tr><td>Aqua</td><td>0.8.2</td></tr><tr><td>IBM Q Provider</td><td>0.11.1</td></tr><tr><th>System information</th></tr><tr><td>Python</td><td>3.8.5 (default, Aug  5 2020, 03:39:04) \n",
       "[Clang 10.0.0 ]</td></tr><tr><td>OS</td><td>Darwin</td></tr><tr><td>CPUs</td><td>8</td></tr><tr><td>Memory (Gb)</td><td>32.0</td></tr><tr><td colspan='2'>Sat Feb 27 11:07:23 2021 AST</td></tr></table>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<div style='width: 100%; background-color:#d5d9e0;padding-left: 10px; padding-bottom: 10px; padding-right: 10px; padding-top: 5px'><h3>This code is a part of Qiskit</h3><p>&copy; Copyright IBM 2017, 2021.</p><p>This code is licensed under the Apache License, Version 2.0. You may<br>obtain a copy of this license in the LICENSE.txt file in the root directory<br> of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.<p>Any modifications or derivative works of this code must retain this<br>copyright notice, and modified files need to carry a notice indicating<br>that they have been altered from the originals.</p></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import qiskit.tools.jupyter\n",
    "%qiskit_version_table\n",
    "%qiskit_copyright"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
